package com.example.smarthome;

public class Main {
    public static void main(String[] args) {
        try {
            HomeManager manager = new HomeManager();

            SmartLight light = new SmartLight("L001", "客厅灯");
            SmartAC ac = new SmartAC("A001", "卧室空调");
            SmartCurtain curtain = new SmartCurtain("C001", "书房窗帘");
            SmartTV tv = new SmartTV("T001", "客厅电视");

            manager.addDevice(light);
            manager.addDevice(ac);
            manager.addDevice(curtain);
            manager.addDevice(tv);

            // 独立操作
            manager.turnOnDevice("L001");
            light.setBrightness(70);

            manager.turnOnDevice("A001");
            ac.setTemperature(25);

            tv.turnOn();
            tv.setChannel(5);
            tv.setVolume(40);

            manager.displayAllDevices();

            // 场景模式
            SceneMode homeScene = new SceneMode("回家模式");
            homeScene.addDevice(light);
            homeScene.addDevice(ac);
            homeScene.addDevice(tv);
            homeScene.applyScene();

            homeScene.closeScene();

        } catch (DeviceNotFoundException e) {
            System.out.println("错误：" + e.getMessage());
        }
    }
}